package com.ruoyi.management.basics.service.impl;

import com.ruoyi.management.basics.domain.TEmployee;
import com.ruoyi.management.basics.mapper.TEmployeeMapper;
import com.ruoyi.management.basics.ro.GetEmployeesParam;
import com.ruoyi.management.basics.service.ITEmployeeService;
import com.ruoyi.management.basics.vo.GetDriverDetailVo;
import com.ruoyi.management.basics.vo.GetDriverVo;
import com.ruoyi.management.basics.vo.GetEmployeesVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 【请填写功能名称】Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-11-30
 */
@Service
public class TEmployeeServiceImpl implements ITEmployeeService {
    @Autowired
    private TEmployeeMapper tEmployeeMapper;


    @Override
    @Transactional(rollbackFor = Exception.class)
    public TEmployee getTEmployeeByTelAndIdCard(String tel, String idCard) {
        return tEmployeeMapper.selectTEmployeeByTelAndIdCard(tel,idCard);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public TEmployee getTEmployeeByNameAndIdCard(String tel, String idCard) {
        return tEmployeeMapper.selectTEmployeeByNameAndIdCard(tel,idCard);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public GetDriverDetailVo getEmployeeDetailByPhone(String phone) {
        GetDriverDetailVo employee = tEmployeeMapper.selectEmployeeDetailByPhone(phone);

        return employee;
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<GetEmployeesVo> getDrivers(GetEmployeesParam param) {
        return tEmployeeMapper.getDrivers(param);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public GetDriverVo getEmployeeByPhone(String username) {
        return tEmployeeMapper.getEmployeeByPhone(username);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public String getIdCardByUsername(String userName) {
        return tEmployeeMapper.getIdCardByUsername(userName);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public GetDriverDetailVo getEmployeeDetailByIdcard(String idCard) {
        return tEmployeeMapper.getEmployeeDetailByIdcard(idCard);
    }

}
